//会员操作使用
import net from './net'

let request=(url="",data={})=>{
    let post_url = net.http_url+url;
    let token = wx.getStorageSync('token');
    let param = {token:token};
    param={...param,...data};
    return new Promise((res,rjs)=>{
        wx.request({
          url: post_url,
          method:'POST',
          data:param,
          success:(result)=>{
              if(result.data.result=='login_error'){
                  wx.showModal({
                    title: '提示',
                    content: '请先登录',
                    complete: (res) => {
                      if (res.confirm) {
                        wx.navigateTo({
                          url: '/mine/index/index',
                        })
                      }
                    }
                  })
              }
              res(result);
          },
          fail:(result)=>{
              wx.showModal({
                title: '提示',
                content: result.errMsg,
                showCancel:false,
                complete: (res) => {
                  if (res.confirm) {
                  }
                }
              })
          }
        })
    });
}

export default{
    request,
}